<!DOCTYPE html>
<html id="docs" lang="en" class="">
	<head>
	<meta charset="utf-8">
<title>Extend the Kubernetes API with CustomResourceDefinitions - Kubernetes</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/png" href="../../../../../images/favicon.png">
<link rel="stylesheet" type="text/css" href="../../../../../css/base_fonts.css">
<link rel="stylesheet" type="text/css" href="../../../../../css/styles.css">
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css">
<link rel="stylesheet" type="text/css" href="../../../../../css/callouts.css">
<link rel="stylesheet" type="text/css" href="../../../../../css/custom-jekyll/tags.css">




<meta name="description" content="Extend the Kubernetes API with CustomResourceDefinitions" />
<meta property="og:description" content="Extend the Kubernetes API with CustomResourceDefinitions" />

<meta property="og:url" content="https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/" />
<meta property="og:title" content="Extend the Kubernetes API with CustomResourceDefinitions - Kubernetes" />

<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script
src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
<script src="../../../../../js/script.js"></script>
<script src="../../../../../js/custom-jekyll/tags.js"></script>


	</head>
	<body>
		<div id="cellophane" onclick="kub.toggleMenu()"></div>

<header>
    <a href="../../../../../index.html" class="logo"></a>

    <div class="nav-buttons" data-auto-burger="primary">
        <ul class="global-nav">
            
            
            <li><a href="../../../../home.1">Documentation</a></li>
            
            <li><a href="../../../../../blog/index.html">Blog</a></li>
            
            <li><a href="../../../../../partners/index.html">Partners</a></li>
            
            <li><a href="../../../../../community/index.html">Community</a></li>
            
            <li><a href="../../../../../case-studies/index.html">Case Studies</a></li>
            
            
             <li>
                <a href="../../extend-api-custom-resource-definitions/index.html#">
                    English <span class="ui-icon ui-icon-carat-1-s"></span>
                </a>
                <ul>
                
                    <li><a href="../../../../../zh/index.html">中文 Chinese</a></li>
                
                    <li><a href="../../../../../ko/index.html">한국어 Korean</a></li>
                
                </ul>
            </li>
         
            <li>
                <a href="../../extend-api-custom-resource-definitions/index.html#">
                    v1.11 <span class="ui-icon ui-icon-carat-1-s"></span>
                </a>
                <ul>
                
                    <li><a href="https://kubernetes.io">v1.12</a></li>
                
                    <li><a href="../../../../../index.html">v1.11</a></li>
                
                    <li><a href="https://v1-10.docs.kubernetes.io">v1.10</a></li>
                
                    <li><a href="https://v1-9.docs.kubernetes.io">v1.9</a></li>
                
                </ul>
            </li>
        </ul>
        
        <a href="../../../../tutorials/kubernetes-basics/index.html" class="button" id="tryKubernetes" data-auto-burger-exclude>Try Kubernetes</a>
        <button id="hamburger" onclick="kub.toggleMenu()" data-auto-burger-exclude><div></div></button>
    </div>

    <nav id="mainNav">
        <main data-auto-burger="primary">
        <div class="nav-box">
            <h3><a href="../../../../tutorials/stateless-application/hello-minikube/index.html">Get Started</a></h3>
            <p>Ready to get your hands dirty? Build a simple Kubernetes cluster that runs "Hello World" for Node.js.</p>
        </div>
        <div class="nav-box">
            <h3><a href="../../../../home.1">Documentation</a></h3>
            <p>Learn how to use Kubernetes with the use of walkthroughs, samples, and reference documentation. You can even <a href="../../../../../editdocs/index.html" data-auto-burger-exclude>help contribute to the docs</a>!</p>
        </div>
        <div class="nav-box">
            <h3><a href="../../../../../community/index.html">Community</a></h3>
            <p>If you need help, you can connect with other Kubernetes users and the Kubernetes authors, attend community events, and watch video presentations from around the web.</p>
        </div>
        <div class="nav-box">
            <h3><a href="../../../../../blog/index.html">Blog</a></h3>
            <p>Read the latest news for Kubernetes and the containers space in general, and get technical how-tos hot off the presses.</p>
        </div>
        </main>
        <main data-auto-burger="primary">
        <div class="left">
            <h5 class="github-invite">Interested in hacking on the core Kubernetes code base?</h5>
            <a href="https://github.com/kubernetes/kubernetes" class="button" data-auto-burger-exclude>View On Github</a>
        </div>

        <div class="right">
            <h5 class="github-invite">Explore the community</h5>
            <div class="social">
                <a href="https://twitter.com/kubernetesio" class="twitter"><span>Twitter</span></a>
                <a href="https://github.com/kubernetes/kubernetes" class="github"><span>Github</span></a>
                <a href="http://slack.k8s.io/" class="slack"><span>Slack</span></a>
                <a href="http://stackoverflow.com/questions/tagged/kubernetes" class="stack-overflow"><span>Stack Overflow</span></a>
                <a href="https://discuss.kubernetes.io" class="mailing-list"><span>Forum</span></a>
                <a href="https://calendar.google.com/calendar/embed?src=nt2tcnbtbied3l6gi2h29slvc0%40group.calendar.google.com" class="calendar"><span>Events Calendar</span></a>
            </div>
        </div>
        <div class="clear" style="clear: both"></div>
        </main>
    </nav>
</header>

		
		
		<section id="hero" class="light-text no-sub">
			











<h1>Tasks</h1>
<h5></h5>






<div id="vendorStrip" class="light-text">
	<ul>
		
		
		<li><a href="../../../../home.1">DOCUMENTATION</a></li>
		
		
		<li><a href="../../../../setup/index.html">SETUP</a></li>
		
		
		<li><a href="../../../../concepts/index.html">CONCEPTS</a></li>
		
		
		<li><a href="../../../index.html" class="YAH">TASKS</a></li>
		
		
		<li><a href="../../../../tutorials/index.html">TUTORIALS</a></li>
		
		
		<li><a href="../../../../reference.1">REFERENCE</a></li>
		
	</ul>
	<div id="searchBox">
		<input type="text" id="search" placeholder="Search" onkeydown="if (event.keyCode==13) window.location.replace('/docs/search/?q=' + this.value)" autofocus="autofocus">
	</div>
</div>

		</section>
		
		
<section id="deprecationWarning">
  <main>
    <div class="content deprecation-warning">
      <h3>
        Documentation for Kubernetes v1.11 is no longer actively maintained. The version you are currently viewing is a static snapshot.
        For up-to-date documentation, see the <a href="https://kubernetes.io/docs/home/">latest</a> version.
      </h3>
    </div>
  </main>
</section>


		<section id="encyclopedia">
			
<div id="docsToc">
     <div class="pi-accordion">
    	
        
        
        
        
        
         
             
                 
             
         
             
                 
             
         
             
                 
             
         
             
                 
             
         
             
                 
                          
                          
                 
             
         
             
         
             
         
             
         
         
        
        <a class="item" data-title="Tasks" href="../../../index.html"></a>

	
	
		
		
	<div class="item" data-title="Install Tools">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Install and Set Up kubectl" href="../../../kubectl/install/index.html"></a>

		
	
		
		
<a class="item" data-title="Install Minikube" href="../../../tools/install-minikube/index.html"></a>

		
	
		
		
<a class="item" data-title="Installing kubeadm" href="../../../../setup/independent/install-kubeadm/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Configure Pods and Containers">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Assign Memory Resources to Containers and Pods" href="../../../configure-pod-container/assign-cpu-ram-container"></a>

		
	
		
		
<a class="item" data-title="Assign CPU Resources to Containers and Pods" href="../../../configure-pod-container/assign-cpu-resource/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure Quality of Service for Pods" href="../../../configure-pod-container/quality-service-pod/index.html"></a>

		
	
		
		
<a class="item" data-title="Assign Extended Resources to a Container" href="../../../configure-pod-container/extended-resource/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure a Pod to Use a Volume for Storage" href="../../../configure-pod-container/configure-volume-storage/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure a Pod to Use a PersistentVolume for Storage" href="../../../configure-pod-container/configure-persistent-volume-storage/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure a Pod to Use a Projected Volume for Storage" href="../../../configure-pod-container/configure-projected-volume-storage/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure a Security Context for a Pod or Container" href="../../../../user-guide/security-context"></a>

		
	
		
		
<a class="item" data-title="Configure Service Accounts for Pods" href="../../../../user-guide/service-accounts"></a>

		
	
		
		
<a class="item" data-title="Pull an Image from a Private Registry" href="../../../configure-pod-container/pull-image-private-registry/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure Liveness and Readiness Probes" href="../../../../user-guide/liveness/index.html"></a>

		
	
		
		
<a class="item" data-title="Assign Pods to Nodes" href="../../../configure-pod-container/assign-pods-nodes/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure Pod Initialization" href="../../../configure-pod-container/configure-pod-initialization/index.html"></a>

		
	
		
		
<a class="item" data-title="Attach Handlers to Container Lifecycle Events" href="../../../configure-pod-container/attach-handler-lifecycle-event/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure a Pod to Use a ConfigMap" href="../../../configure-pod-container/configure-pod-configmap/index.html"></a>

		
	
		
		
<a class="item" data-title="Share Process Namespace between Containers in a Pod" href="../../../configure-pod-container/share-process-namespace/index.html"></a>

		
	
		
		
<a class="item" data-title="Translate a Docker Compose File to Kubernetes Resources" href="../../../configure-pod-container/translate-compose-kubernetes/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Administer a Cluster">
		<div class="container">
		
		
	
	
		
		
	<div class="item" data-title="Administration with kubeadm">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Upgrading kubeadm HA clusters from 1.9.x to 1.9.y" href="../../../administer-cluster/kubeadm/kubeadm-upgrade-ha/index.html"></a>

		
	
		
		
<a class="item" data-title="Upgrading kubeadm clusters from 1.7 to 1.8" href="../../../administer-cluster/kubeadm/kubeadm-upgrade-1-8/index.html"></a>

		
	
		
		
<a class="item" data-title="Upgrading kubeadm clusters from v1.10 to v1.11" href="../../../administer-cluster/kubeadm/kubeadm-upgrade-1-11/index.html"></a>

		
	
		
		
<a class="item" data-title="Upgrading/downgrading kubeadm clusters between v1.8 to v1.9" href="../../../administer-cluster/kubeadm/kubeadm-upgrade-1-9/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Manage Memory, CPU, and API Resources">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Configure Default Memory Requests and Limits for a Namespace" href="../../../configure-pod-container/limit-range/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure Default CPU Requests and Limits for a Namespace" href="../../../administer-cluster/cpu-default-namespace/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure Minimum and Maximum Memory Constraints for a Namespace" href="../../../administer-cluster/memory-constraint-namespace/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure Minimum and Maximum CPU Constraints for a Namespace" href="../../../administer-cluster/cpu-constraint-namespace/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure Memory and CPU Quotas for a Namespace" href="../../../administer-cluster/quota-memory-cpu-namespace/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure a Pod Quota for a Namespace" href="../../../administer-cluster/quota-pod-namespace/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Install a Network Policy Provider">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Use Calico for NetworkPolicy" href="../../../administer-cluster/network-policy-provider/calico-network-policy/index.html"></a>

		
	
		
		
<a class="item" data-title="Use Cilium for NetworkPolicy" href="../../../administer-cluster/network-policy-provider/cilium-network-policy/index.html"></a>

		
	
		
		
<a class="item" data-title="Use Kube-router for NetworkPolicy" href="../../../administer-cluster/network-policy-provider/kube-router-network-policy/index.html"></a>

		
	
		
		
<a class="item" data-title="Romana for NetworkPolicy" href="../../../administer-cluster/network-policy-provider/romana-network-policy/index.html"></a>

		
	
		
		
<a class="item" data-title="Weave Net for NetworkPolicy" href="../../../administer-cluster/network-policy-provider/weave-network-policy/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
<a class="item" data-title="Access Clusters Using the Kubernetes API" href="../../../administer-cluster/access-cluster-api/index.html"></a>

		
	
		
		
<a class="item" data-title="Access Services Running on Clusters" href="../../../administer-cluster/access-cluster-services/index.html"></a>

		
	
		
		
<a class="item" data-title="Advertise Extended Resources for a Node" href="../../../administer-cluster/extended-resource-node/index.html"></a>

		
	
		
		
<a class="item" data-title="Autoscale the DNS Service in a Cluster" href="../../../administer-cluster/dns-horizontal-autoscaling/index.html"></a>

		
	
		
		
<a class="item" data-title="Change the Reclaim Policy of a PersistentVolume" href="../../../administer-cluster/change-pv-reclaim-policy/index.html"></a>

		
	
		
		
<a class="item" data-title="Change the default StorageClass" href="../../../administer-cluster/change-default-storage-class/index.html"></a>

		
	
		
		
<a class="item" data-title="Cluster Management" href="../../../../admin/cluster-management/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure Multiple Schedulers" href="../../../administer-cluster/configure-multiple-schedulers/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure Out Of Resource Handling" href="../../../administer-cluster/reserve-compute-resources/out-of-resource.md"></a>

		
	
		
		
<a class="item" data-title="Configure Quotas for API Objects" href="../../../administer-cluster/quota-api-object/index.html"></a>

		
	
		
		
<a class="item" data-title="Control CPU Management Policies on the Node" href="../../../administer-cluster/cpu-management-policies/index.html"></a>

		
	
		
		
<a class="item" data-title="Customizing DNS Service" href="../../../administer-cluster/dns-custom-nameservers/index.html"></a>

		
	
		
		
<a class="item" data-title="Debugging DNS Resolution" href="../../../administer-cluster/dns-debugging-resolution/index.html"></a>

		
	
		
		
<a class="item" data-title="Declare Network Policy" href="../../../configure-pod-container/declare-network-policy/index.html"></a>

		
	
		
		
<a class="item" data-title="Developing Cloud Controller Manager" href="../../../administer-cluster/developing-cloud-controller-manager.md"></a>

		
	
		
		
<a class="item" data-title="Encrypting Secret Data at Rest" href="../../../administer-cluster/encrypt-data.1"></a>

		
	
		
		
<a class="item" data-title="Guaranteed Scheduling For Critical Add-On Pods" href="../../../administer-cluster/guaranteed-scheduling-critical-addon-pods/index.html"></a>

		
	
		
		
<a class="item" data-title="IP Masquerade Agent User Guide" href="../../../administer-cluster/ip-masq-agent/index.html"></a>

		
	
		
		
<a class="item" data-title="Kubernetes Cloud Controller Manager" href="../../../administer-cluster/running-cloud-controller.md"></a>

		
	
		
		
<a class="item" data-title="Limit Storage Consumption" href="../../../administer-cluster/limit-storage-consumption/index.html"></a>

		
	
		
		
<a class="item" data-title="Namespaces Walkthrough" href="../../../administer-cluster/namespaces-walkthrough/index.html"></a>

		
	
		
		
<a class="item" data-title="Operating etcd clusters for Kubernetes" href="../../../administer-cluster/configure-upgrade-etcd/index.html"></a>

		
	
		
		
<a class="item" data-title="Reconfigure a Node&#39;s Kubelet in a Live Cluster" href="../../../administer-cluster/reconfigure-kubelet.1"></a>

		
	
		
		
<a class="item" data-title="Reserve Compute Resources for System Daemons" href="../../../administer-cluster/reserve-compute-resources/index.html"></a>

		
	
		
		
<a class="item" data-title="Safely Drain a Node while Respecting Application SLOs" href="../../../administer-cluster/safely-drain-node/index.html"></a>

		
	
		
		
<a class="item" data-title="Securing a Cluster" href="../../../administer-cluster/securing-a-cluster/index.html"></a>

		
	
		
		
<a class="item" data-title="Set Kubelet parameters via a config file" href="../../../administer-cluster/kubelet-config-file.1"></a>

		
	
		
		
<a class="item" data-title="Set up High-Availability Kubernetes Masters" href="../../../administer-cluster/highly-available-master/index.html"></a>

		
	
		
		
<a class="item" data-title="Set up a Highly Availabile etcd Cluster With kubeadm" href="../../../administer-cluster/setup-ha-etcd-with-kubeadm/index.html"></a>

		
	
		
		
<a class="item" data-title="Share a Cluster with Namespaces" href="../../../../admin/namespaces"></a>

		
	
		
		
<a class="item" data-title="Static Pods" href="../../../../concepts/cluster-administration/static-pod/index.html"></a>

		
	
		
		
<a class="item" data-title="Storage Object in Use Protection" href="../../../administer-cluster/storage-object-in-use-protection/index.html"></a>

		
	
		
		
<a class="item" data-title="Using CoreDNS for Service Discovery" href="../../../administer-cluster/coredns/index.html"></a>

		
	
		
		
<a class="item" data-title="Using a KMS provider for data encryption" href="../../../administer-cluster/kms-provider/index.html"></a>

		
	
		
		
<a class="item" data-title="Using sysctls in a Kubernetes Cluster" href="../../../../concepts/cluster-administration/sysctl-cluster/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Inject Data Into Applications">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Define a Command and Arguments for a Container" href="../../../../user-guide/containers/index.html"></a>

		
	
		
		
<a class="item" data-title="Define Environment Variables for a Container" href="../../../inject-data-application/define-environment-variable-container/index.html"></a>

		
	
		
		
<a class="item" data-title="Expose Pod Information to Containers Through Environment Variables" href="../../../configure-pod-container/environment-variable-expose-pod-information/index.html"></a>

		
	
		
		
<a class="item" data-title="Expose Pod Information to Containers Through Files" href="../../../inject-data-application/downward-api-volume-expose-pod-information/index.html"></a>

		
	
		
		
<a class="item" data-title="Distribute Credentials Securely Using Secrets" href="../../../inject-data-application/distribute-credentials-secure/index.html"></a>

		
	
		
		
<a class="item" data-title="Inject Information into Pods Using a PodPreset" href="../../../inject-data-application/podpreset.1"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Run Applications">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Run a Stateless Application Using a Deployment" href="../../../../user-guide/simple-nginx"></a>

		
	
		
		
<a class="item" data-title="Run a Single-Instance Stateful Application" href="../../../../tutorials/stateful-application/run-stateful-application/index.html"></a>

		
	
		
		
<a class="item" data-title="Run a Replicated Stateful Application" href="../../../run-application/run-replicated-stateful-application/index.html"></a>

		
	
		
		
<a class="item" data-title="Update API Objects in Place Using kubectl patch" href="../../../run-application/update-api-object-kubectl-patch/index.html"></a>

		
	
		
		
<a class="item" data-title="Scale a StatefulSet" href="../../../run-application/scale-stateful-set/index.html"></a>

		
	
		
		
<a class="item" data-title="Delete a StatefulSet" href="../../../manage-stateful-set/delete-pods/index.html"></a>

		
	
		
		
<a class="item" data-title="Force Delete StatefulSet Pods" href="../../../run-application/force-delete-stateful-set-pod/index.html"></a>

		
	
		
		
<a class="item" data-title="Perform Rolling Update Using a Replication Controller" href="../../../run-application/rolling-update-replication-controller/index.html"></a>

		
	
		
		
<a class="item" data-title="Horizontal Pod Autoscaler" href="../../../run-application/horizontal-pod-autoscale/index.html"></a>

		
	
		
		
<a class="item" data-title="Horizontal Pod Autoscaler Walkthrough" href="../../../run-application/horizontal-pod-autoscale-walkthrough/index.html"></a>

		
	
		
		
<a class="item" data-title="Specifying a Disruption Budget for your Application" href="../../../configure-pod-container/configure-pod-disruption-budget/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Run Jobs">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Running automated tasks with cron jobs" href="../../../job/automated-tasks-with-cron-jobs.1"></a>

		
	
		
		
<a class="item" data-title="Parallel Processing using Expansions" href="../../../job/parallel-processing-expansion/index.html"></a>

		
	
		
		
<a class="item" data-title="Coarse Parallel Processing Using a Work Queue" href="../../../job/coarse-parallel-processing-work-queue/index.html"></a>

		
	
		
		
<a class="item" data-title="Fine Parallel Processing Using a Work Queue" href="../../../job/fine-parallel-processing-work-queue/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Access Applications in a Cluster">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Web UI (Dashboard)" href="../../../web-ui-dashboard/index.html"></a>

		
	
		
		
<a class="item" data-title="Accessing Clusters" href="../../../../concepts/cluster-administration/access-cluster/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure Access to Multiple Clusters" href="../../../access-application-cluster/authenticate-across-clusters-kubeconfig/index.html"></a>

		
	
		
		
<a class="item" data-title="Use Port Forwarding to Access Applications in a Cluster" href="../../../access-application-cluster/port-forward-access-application-cluster/index.html"></a>

		
	
		
		
<a class="item" data-title="Provide Load-Balanced Access to an Application in a Cluster" href="../../../access-application-cluster/load-balance-access-application-cluster/index.html"></a>

		
	
		
		
<a class="item" data-title="Use a Service to Access an Application in a Cluster" href="../../../access-application-cluster/service-access-application-cluster.1"></a>

		
	
		
		
<a class="item" data-title="Connect a Front End to a Back End Using a Service" href="../../../access-application-cluster/connecting-frontend-backend/index.html"></a>

		
	
		
		
<a class="item" data-title="Create an External Load Balancer" href="../../../../user-guide/load-balancer"></a>

		
	
		
		
<a class="item" data-title="Configure Your Cloud Provider&#39;s Firewalls" href="../../../access-application-cluster/configure-cloud-provider-firewall/index.html"></a>

		
	
		
		
<a class="item" data-title="List All Container Images Running in a Cluster" href="../../../access-application-cluster/list-all-running-container-images/index.html"></a>

		
	
		
		
<a class="item" data-title="Communicate Between Containers in the Same Pod Using a Shared Volume" href="../../../access-application-cluster/communicate-containers-same-pod-shared-volume/index.html"></a>

		
	
		
		
<a class="item" data-title="Configure DNS for a Cluster" href="../../../access-application-cluster/configure-dns-cluster/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Monitor, Log, and Debug">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Application Introspection and Debugging" href="../../../debug-application-cluster/debug-application-introspection/index.html"></a>

		
	
		
		
<a class="item" data-title="Auditing" href="../../../debug-application-cluster/audit/index.html"></a>

		
	
		
		
<a class="item" data-title="Core metrics pipeline" href="../../../debug-application-cluster/core-metrics-pipeline/index.html"></a>

		
	
		
		
<a class="item" data-title="Debug Init Containers" href="../../../debug-application-cluster/debug-init-containers/index.html"></a>

		
	
		
		
<a class="item" data-title="Debug Pods and Replication Controllers" href="../../../debug-application-cluster/debug-pod-replication-controller/index.html"></a>

		
	
		
		
<a class="item" data-title="Debug Services" href="../../../../user-guide/debugging-services"></a>

		
	
		
		
<a class="item" data-title="Debug a StatefulSet" href="../../../manage-stateful-set/debugging-a-statefulset/index.html"></a>

		
	
		
		
<a class="item" data-title="Debugging Kubernetes nodes with crictl" href="../../../debug-application-cluster/crictl/index.html"></a>

		
	
		
		
<a class="item" data-title="Determine the Reason for Pod Failure" href="../../../debug-application-cluster/determine-reason-pod-failure/index.html"></a>

		
	
		
		
<a class="item" data-title="Developing and debugging services locally" href="../../../debug-application-cluster/local-debugging/index.html"></a>

		
	
		
		
<a class="item" data-title="Events in Stackdriver" href="../../../debug-application-cluster/events-stackdriver/index.html"></a>

		
	
		
		
<a class="item" data-title="Get a Shell to a Running Container" href="../../../debug-application-cluster/get-shell-running-container/index.html"></a>

		
	
		
		
<a class="item" data-title="Logging Using Elasticsearch and Kibana" href="../../../../user-guide/logging/elasticsearch.1"></a>

		
	
		
		
<a class="item" data-title="Logging Using Stackdriver" href="../../../../user-guide/logging/stackdriver.1"></a>

		
	
		
		
<a class="item" data-title="Monitor Node Health" href="../../../debug-application-cluster/monitor-node-health/index.html"></a>

		
	
		
		
<a class="item" data-title="Tools for Monitoring Compute, Storage, and Network Resources" href="../../../debug-application-cluster/resource-usage-monitoring/index.html"></a>

		
	
		
		
<a class="item" data-title="Troubleshoot Applications" href="../../../debug-application-cluster/debug-application.1"></a>

		
	
		
		
<a class="item" data-title="Troubleshoot Clusters" href="../../../../admin/cluster-troubleshooting.1"></a>

		
	
		
		
<a class="item" data-title="Troubleshooting" href="../../../../troubleshooting/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Extend Kubernetes">
		<div class="container">
		
		
	
	
		
		
	<div class="item" data-title="Use Custom Resources">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Extend the Kubernetes API with CustomResourceDefinitions" href="../../extend-api-custom-resource-definitions/index.html"></a>

		
	
		
		
<a class="item" data-title="Versions of CustomResourceDefinitions" href="../custom-resource-definition-versioning/index.html"></a>

		
	
		
		
<a class="item" data-title="Migrate a ThirdPartyResource to CustomResourceDefinition" href="../../migrate-third-party-resource/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
<a class="item" data-title="Configure the aggregation layer" href="../../configure-aggregation-layer/index.html"></a>

		
	
		
		
<a class="item" data-title="Setup an extension API server" href="../../setup-extension-api-server/index.html"></a>

		
	
		
		
<a class="item" data-title="Use an HTTP Proxy to Access the Kubernetes API" href="../../http-proxy-access-api.1"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="TLS">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Certificate Rotation" href="../../../tls/certificate-rotation/index.html"></a>

		
	
		
		
<a class="item" data-title="Manage TLS Certificates in a Cluster" href="../../../tls/managing-tls-in-a-cluster.1"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Federation - Run an App on Multiple Clusters">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Cross-cluster Service Discovery using Federated Services" href="../../../../concepts/cluster-administration/federation-service-discovery/index.html"></a>

		
	
		
		
<a class="item" data-title="Set up Cluster Federation with Kubefed" href="../../../../tutorials/federation/set-up-cluster-federation-kubefed/index.html"></a>

		
	
		
		
<a class="item" data-title="Set up CoreDNS as DNS provider for Cluster Federation" href="../../../federation/set-up-coredns-provider-federation/index.html"></a>

		
	
		
		
<a class="item" data-title="Set up placement policies in Federation" href="../../../federation/set-up-placement-policies-federation/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Manage Cluster Daemons">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Perform a Rolling Update on a DaemonSet" href="../../../manage-daemon/update-daemon-set/index.html"></a>

		
	
		
		
<a class="item" data-title="Performing a Rollback on a DaemonSet" href="../../../manage-daemon/rollback-daemon-set/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Install Service Catalog">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Install Service Catalog using Helm" href="../../../service-catalog/install-service-catalog-using-helm/index.html"></a>

		
	
		
		
<a class="item" data-title="Install Service Catalog using SC" href="../../../service-catalog/install-service-catalog-using-sc/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Federation - Run an App on Multiple Clusters">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Federated Cluster" href="../../../administer-federation/cluster/index.html"></a>

		
	
		
		
<a class="item" data-title="Federated ConfigMap" href="../../../administer-federation/configmap/index.html"></a>

		
	
		
		
<a class="item" data-title="Federated DaemonSet" href="../../../administer-federation/daemonset/index.html"></a>

		
	
		
		
<a class="item" data-title="Federated Deployment" href="../../../administer-federation/deployment/index.html"></a>

		
	
		
		
<a class="item" data-title="Federated Events" href="../../../administer-federation/events/index.html"></a>

		
	
		
		
<a class="item" data-title="Federated Horizontal Pod Autoscalers (HPA)" href="../../../administer-federation/hpa/index.html"></a>

		
	
		
		
<a class="item" data-title="Federated Ingress" href="../../../administer-federation/ingress/index.html"></a>

		
	
		
		
<a class="item" data-title="Federated Jobs" href="../../../administer-federation/job/index.html"></a>

		
	
		
		
<a class="item" data-title="Federated Namespaces" href="../../../administer-federation/namespaces/index.html"></a>

		
	
		
		
<a class="item" data-title="Federated ReplicaSets" href="../../../administer-federation/replicaset/index.html"></a>

		
	
		
		
<a class="item" data-title="Federated Secrets" href="../../../administer-federation/secret/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
<a class="item" data-title="Extend kubectl with plugins" href="../../../extend-kubectl/kubectl-plugins/index.html"></a>

		
	
		
		
<a class="item" data-title="Manage HugePages" href="../../../manage-hugepages/scheduling-hugepages/index.html"></a>

		
	
		
		
<a class="item" data-title="Schedule GPUs" href="../../../manage-gpus/scheduling-gpus/index.html"></a>

		
	






     </div> 
    <button class="push-menu-close-button" onclick="kub.toggleToc()"></button>
</div> 

			<div id="docsContent">
				
<p><a href="../../../../editdocs#docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions.md" id="editPageButton">Edit This Page</a></p>

<h1>Extend the Kubernetes API with CustomResourceDefinitions</h1>




<p>This page shows how to install a
<a href="../../../../concepts/api-extension/custom-resources/index.html">custom resource</a>
into the Kubernetes API by creating a
<a href="../../../../reference/generated/kubernetes-api/v1.11/index.html#customresourcedefinition-v1beta1-apiextensions">CustomResourceDefinition</a>.</p>











<ul id="markdown-toc">










<li><a href="../../extend-api-custom-resource-definitions/index.html#before-you-begin">Before you begin</a></li>












<li><a href="../../extend-api-custom-resource-definitions/index.html#create-a-customresourcedefinition">Create a CustomResourceDefinition</a></li>




<li><a href="../../extend-api-custom-resource-definitions/index.html#create-custom-objects">Create custom objects</a></li>




<li><a href="../../extend-api-custom-resource-definitions/index.html#delete-a-customresourcedefinition">Delete a CustomResourceDefinition</a></li>




<li><a href="../../extend-api-custom-resource-definitions/index.html#serving-multiple-versions-of-a-crd">Serving multiple versions of a CRD</a></li>












<li><a href="../../extend-api-custom-resource-definitions/index.html#advanced-topics">Advanced topics</a></li>




















<li><a href="../../extend-api-custom-resource-definitions/index.html#what-s-next">What's next</a></li>



</ul>



<h2 id="before-you-begin">Before you begin</h2>
<p>You need to have a Kubernetes cluster, and the kubectl command-line tool must
be configured to communicate with your cluster. If you do not already have a
cluster, you can create one by using
<a href="../../../../getting-started-guides/minikube">Minikube</a>,
or you can use one of these Kubernetes playgrounds:</p>

<ul>
<li><a href="https://www.katacoda.com/courses/kubernetes/playground" target="_blank">Katacoda</a></li>
<li><a href="http://labs.play-with-k8s.com/" target="_blank">Play with Kubernetes</a></li>
</ul>
 

<p>To check the version, enter <code>kubectl version</code>.</p>

<ul>
<li><p>Make sure your Kubernetes cluster has a master version of 1.7.0 or higher.</p></li>

<li><p>Read about <a href="../../../../concepts/api-extension/custom-resources/index.html">custom resources</a>.</p></li>
</ul>




<h2 id="create-a-customresourcedefinition">Create a CustomResourceDefinition</h2>

<p>When you create a new CustomResourceDefinition (CRD), the Kubernetes API Server
creates a new RESTful resource path for each version you specify. The CRD can be
either namespaced or cluster-scoped, as specified in the CRD&rsquo;s <code>scope</code> field. As
with existing built-in objects, deleting a namespace deletes all custom objects
in that namespace. CustomResourceDefinitions themselves are non-namespaced and
are available to all namespaces.</p>

<p>For example, if you save the following CustomResourceDefinition to <code>resourcedefinition.yaml</code>:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span>apiextensions.k8s.io/v1beta1<span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>CustomResourceDefinition<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span><span style="color:#080;font-style:italic"># name must match the spec fields below, and be in the form: &lt;plural&gt;.&lt;group&gt;</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>crontabs.stable.example.com<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span><span style="color:#080;font-style:italic"># group name to use for REST API: /apis/&lt;group&gt;/&lt;version&gt;</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>group:<span style="color:#bbb"> </span>stable.example.com<span style="color:#bbb">
</span><span style="color:#bbb">  </span><span style="color:#080;font-style:italic"># list of versions supported by this CustomResourceDefinition</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>versions:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>v1<span style="color:#bbb">
</span><span style="color:#bbb">      </span><span style="color:#080;font-style:italic"># Each version can be enabled/disabled by Served flag.</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>served:<span style="color:#bbb"> </span><span style="color:#a2f;font-weight:bold">true</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span><span style="color:#080;font-style:italic"># One and only one version must be marked as the storage version.</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>storage:<span style="color:#bbb"> </span><span style="color:#a2f;font-weight:bold">true</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span><span style="color:#080;font-style:italic"># either Namespaced or Cluster</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>scope:<span style="color:#bbb"> </span>Namespaced<span style="color:#bbb">
</span><span style="color:#bbb">  </span>names:<span style="color:#bbb">
</span><span style="color:#bbb">    </span><span style="color:#080;font-style:italic"># plural name to be used in the URL: /apis/&lt;group&gt;/&lt;version&gt;/&lt;plural&gt;</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>plural:<span style="color:#bbb"> </span>crontabs<span style="color:#bbb">
</span><span style="color:#bbb">    </span><span style="color:#080;font-style:italic"># singular name to be used as an alias on the CLI and for display</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>singular:<span style="color:#bbb"> </span>crontab<span style="color:#bbb">
</span><span style="color:#bbb">    </span><span style="color:#080;font-style:italic"># kind is normally the CamelCased singular type. Your resource manifests use this.</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>kind:<span style="color:#bbb"> </span>CronTab<span style="color:#bbb">
</span><span style="color:#bbb">    </span><span style="color:#080;font-style:italic"># shortNames allow shorter string to match your resource on the CLI</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>shortNames:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>ct</code></pre></div>
<p>And create it:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f resourcedefinition.yaml</code></pre></div>
<p>Then a new namespaced RESTful API endpoint is created at:</p>

<pre><code>/apis/stable.example.com/v1/namespaces/*/crontabs/...
</code></pre>

<p>This endpoint URL can then be used to create and manage custom objects.
The <code>kind</code> of these objects will be <code>CronTab</code> from the spec of the
CustomResourceDefinition object you created above.</p>

<p>It might take a few seconds for the endpoint to be created.
You can watch the <code>Established</code> condition of your CustomResourceDefinition
to be true or watch the discovery information of the API server for your
resource to show up.</p>

<h2 id="create-custom-objects">Create custom objects</h2>

<p>After the CustomResourceDefinition object has been created, you can create
custom objects. Custom objects can contain custom fields. These fields can
contain arbitrary JSON.
In the following example, the <code>cronSpec</code> and <code>image</code> custom fields are set in a
custom object of kind <code>CronTab</code>.  The kind <code>CronTab</code> comes from the spec of the
CustomResourceDefinition object you created above.</p>

<p>If you save the following YAML to <code>my-crontab.yaml</code>:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span><span style="color:#b44">&#34;stable.example.com/v1&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>CronTab<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>my-new-cron-object<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>cronSpec:<span style="color:#bbb"> </span><span style="color:#b44">&#34;* * * * */5&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>image:<span style="color:#bbb"> </span>my-awesome-cron-image</code></pre></div>
<p>and create it:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f my-crontab.yaml</code></pre></div>
<p>You can then manage your CronTab objects using kubectl. For example:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl get crontab</code></pre></div>
<p>Should print a list like this:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-console" data-lang="console">NAME                 AGE
my-new-cron-object   6s</code></pre></div>
<p>Resource names are not case-sensitive when using kubectl, and you can use either
the singular or plural forms defined in the CRD, as well as any short names.</p>

<p>You can also view the raw YAML data:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl get ct -o yaml</code></pre></div>
<p>You should see that it contains the custom <code>cronSpec</code> and <code>image</code> fields
from the yaml you used to create it:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-console" data-lang="console">apiVersion: v1
items:
- apiVersion: stable.example.com/v1
  kind: CronTab
  metadata:
    clusterName: &#34;&#34;
    creationTimestamp: 2017-05-31T12:56:35Z
    deletionGracePeriodSeconds: null
    deletionTimestamp: null
    name: my-new-cron-object
    namespace: default
    resourceVersion: &#34;285&#34;
    selfLink: /apis/stable.example.com/v1/namespaces/default/crontabs/my-new-cron-object
    uid: 9423255b-4600-11e7-af6a-28d2447dc82b
  spec:
    cronSpec: &#39;* * * * */5&#39;
    image: my-awesome-cron-image
kind: List
metadata:
  resourceVersion: &#34;&#34;
  selfLink: &#34;&#34;</code></pre></div>
<h2 id="delete-a-customresourcedefinition">Delete a CustomResourceDefinition</h2>

<p>When you delete a CustomResourceDefinition, the server will uninstall the RESTful API  endpoint
and <strong>delete all custom objects stored in it</strong>.</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl delete -f resourcedefinition.yaml
kubectl get crontabs</code></pre></div><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-console" data-lang="console">Error from server (NotFound): Unable to list &#34;crontabs&#34;: the server could not find the requested resource (get crontabs.stable.example.com)</code></pre></div>
<p>If you later recreate the same CustomResourceDefinition, it will start out empty.</p>

<h2 id="serving-multiple-versions-of-a-crd">Serving multiple versions of a CRD</h2>

<p>See <a href="https://v1-11.docs.kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/custom-resource-definition-versioning" target="_blank">Custom resource definition versioning</a>
for more information about serving multiple versions of your
CustomResourceDefinition and migrating your objects from one version to another.</p>




<h2 id="advanced-topics">Advanced topics</h2>

<h3 id="finalizers">Finalizers</h3>

<p><em>Finalizers</em> allow controllers to implement asynchronous pre-delete hooks.
Custom objects support finalizers just like built-in objects.</p>

<p>You can add a finalizer to a custom object like this:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span><span style="color:#b44">&#34;stable.example.com/v1&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>CronTab<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>finalizers:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>-<span style="color:#bbb"> </span>finalizer.stable.example.com</code></pre></div>
<p>Finalizers are arbitrary string values, that when present ensure that a hard delete
of a resource is not possible while they exist.</p>

<p>The first delete request on an object with finalizers merely sets a value for the
<code>metadata.deletionTimestamp</code> field instead of deleting it. Once this value is set,
entries in the <code>finalizer</code> list can only be removed.</p>

<p>This triggers controllers watching the object to execute any finalizers they handle.
This will be represented via polling update requests for that
object, until all finalizers have been removed and the resource is deleted.</p>

<p>The time period of polling update can be controlled by <code>metadata.deletionGracePeriodSeconds</code>.</p>

<p>It is the responsibility of each controller to removes its finalizer from the list.</p>

<p>Kubernetes will only finally delete the object if the list of finalizers is empty,
meaning all finalizers are done.</p>

<h3 id="validation">Validation</h3>

<p>Validation of custom objects is possible via
<a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#schemaObject" target="_blank">OpenAPI v3 schema</a>.
Additionally, the following restrictions are applied to the schema:</p>

<ul>
<li>The fields <code>default</code>, <code>nullable</code>, <code>discriminator</code>, <code>readOnly</code>, <code>writeOnly</code>, <code>xml</code>,
<code>deprecated</code> and <code>$ref</code> cannot be set.</li>
<li>The field <code>uniqueItems</code> cannot be set to true.</li>
<li>The field <code>additionalProperties</code> cannot be set to false.</li>
</ul>

<p>This feature is <strong>beta</strong> in v1.9.
You can disable this feature using the <code>CustomResourceValidation</code> feature gate on
the <a href="../../../../admin/kube-apiserver.1">kube-apiserver</a>:</p>

<pre><code>--feature-gates=CustomResourceValidation=false
</code></pre>

<p>The schema is defined in the CustomResourceDefinition. In the following example, the
CustomResourceDefinition applies the following validations on the custom object:</p>

<ul>
<li><code>spec.cronSpec</code> must be a string and must be of the form described by the regular expression.</li>
<li><code>spec.replicas</code> must be an integer and must have a minimum value of 1 and a maximum value of 10.</li>
</ul>

<p>Save the CustomResourceDefinition to <code>resourcedefinition.yaml</code>:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span>apiextensions.k8s.io/v1beta1<span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>CustomResourceDefinition<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>crontabs.stable.example.com<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>group:<span style="color:#bbb"> </span>stable.example.com<span style="color:#bbb">
</span><span style="color:#bbb">  </span>versions:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>v1<span style="color:#bbb">
</span><span style="color:#bbb">      </span>served:<span style="color:#bbb"> </span><span style="color:#a2f;font-weight:bold">true</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>storage:<span style="color:#bbb"> </span><span style="color:#a2f;font-weight:bold">true</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>version:<span style="color:#bbb"> </span>v1<span style="color:#bbb">
</span><span style="color:#bbb">  </span>scope:<span style="color:#bbb"> </span>Namespaced<span style="color:#bbb">
</span><span style="color:#bbb">  </span>names:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>plural:<span style="color:#bbb"> </span>crontabs<span style="color:#bbb">
</span><span style="color:#bbb">    </span>singular:<span style="color:#bbb"> </span>crontab<span style="color:#bbb">
</span><span style="color:#bbb">    </span>kind:<span style="color:#bbb"> </span>CronTab<span style="color:#bbb">
</span><span style="color:#bbb">    </span>shortNames:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>ct<span style="color:#bbb">
</span><span style="color:#bbb">  </span>validation:<span style="color:#bbb">
</span><span style="color:#bbb">   </span><span style="color:#080;font-style:italic"># openAPIV3Schema is the schema for validating custom objects.</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>openAPIV3Schema:<span style="color:#bbb">
</span><span style="color:#bbb">      </span>properties:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">          </span>properties:<span style="color:#bbb">
</span><span style="color:#bbb">            </span>cronSpec:<span style="color:#bbb">
</span><span style="color:#bbb">              </span>type:<span style="color:#bbb"> </span>string<span style="color:#bbb">
</span><span style="color:#bbb">              </span>pattern:<span style="color:#bbb"> </span><span style="color:#b44">&#39;^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$&#39;</span><span style="color:#bbb">
</span><span style="color:#bbb">            </span>replicas:<span style="color:#bbb">
</span><span style="color:#bbb">              </span>type:<span style="color:#bbb"> </span>integer<span style="color:#bbb">
</span><span style="color:#bbb">              </span>minimum:<span style="color:#bbb"> </span><span style="color:#666">1</span><span style="color:#bbb">
</span><span style="color:#bbb">              </span>maximum:<span style="color:#bbb"> </span><span style="color:#666">10</span></code></pre></div>
<p>And create it:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f resourcedefinition.yaml</code></pre></div>
<p>A request to create a custom object of kind <code>CronTab</code> will be rejected if there are invalid values in its fields.
In the following example, the custom object contains fields with invalid values:</p>

<ul>
<li><code>spec.cronSpec</code> does not match the regular expression.</li>
<li><code>spec.replicas</code> is greater than 10.</li>
</ul>

<p>If you save the following YAML to <code>my-crontab.yaml</code>:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span><span style="color:#b44">&#34;stable.example.com/v1&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>CronTab<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>my-new-cron-object<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>cronSpec:<span style="color:#bbb"> </span><span style="color:#b44">&#34;* * * *&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>image:<span style="color:#bbb"> </span>my-awesome-cron-image<span style="color:#bbb">
</span><span style="color:#bbb">  </span>replicas:<span style="color:#bbb"> </span><span style="color:#666">15</span></code></pre></div>
<p>and create it:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f my-crontab.yaml</code></pre></div>
<p>you will get an error:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-console" data-lang="console">The CronTab &#34;my-new-cron-object&#34; is invalid: []: Invalid value: map[string]interface {}{&#34;apiVersion&#34;:&#34;stable.example.com/v1&#34;, &#34;kind&#34;:&#34;CronTab&#34;, &#34;metadata&#34;:map[string]interface {}{&#34;name&#34;:&#34;my-new-cron-object&#34;, &#34;namespace&#34;:&#34;default&#34;, &#34;deletionTimestamp&#34;:interface {}(nil), &#34;deletionGracePeriodSeconds&#34;:(*int64)(nil), &#34;creationTimestamp&#34;:&#34;2017-09-05T05:20:07Z&#34;, &#34;uid&#34;:&#34;e14d79e7-91f9-11e7-a598-f0761cb232d1&#34;, &#34;selfLink&#34;:&#34;&#34;, &#34;clusterName&#34;:&#34;&#34;}, &#34;spec&#34;:map[string]interface {}{&#34;cronSpec&#34;:&#34;* * * *&#34;, &#34;image&#34;:&#34;my-awesome-cron-image&#34;, &#34;replicas&#34;:15}}:
validation failure list:
spec.cronSpec in body should match &#39;^(\d+|\*)(/\d+)?(\s+(\d+|\*)(/\d+)?){4}$&#39;
spec.replicas in body should be less than or equal to 10</code></pre></div>
<p>If the fields contain valid values, the object creation request is accepted.</p>

<p>Save the following YAML to <code>my-crontab.yaml</code>:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span><span style="color:#b44">&#34;stable.example.com/v1&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>CronTab<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>my-new-cron-object<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>cronSpec:<span style="color:#bbb"> </span><span style="color:#b44">&#34;* * * * */5&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>image:<span style="color:#bbb"> </span>my-awesome-cron-image<span style="color:#bbb">
</span><span style="color:#bbb">  </span>replicas:<span style="color:#bbb"> </span><span style="color:#666">5</span></code></pre></div>
<p>And create it:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f my-crontab.yaml
crontab <span style="color:#b44">&#34;my-new-cron-object&#34;</span> created</code></pre></div>
<h3 id="subresources">Subresources</h3>

<p>Custom resources support <code>/status</code> and <code>/scale</code> subresources.
This feature is <strong>beta</strong> in v1.11 and enabled by default.</p>

<p>You can disable this feature using the <code>CustomResourceSubresources</code> feature gate on
the <a href="../../../../admin/kube-apiserver.1">kube-apiserver</a>:</p>

<pre><code>--feature-gates=CustomResourceSubresources=false
</code></pre>

<p>The status and scale subresources can be optionally enabled by
defining them in the CustomResourceDefinition.</p>

<h4 id="status-subresource">Status subresource</h4>

<p>When the status subresource is enabled, the <code>/status</code> subresource for the custom resource is exposed.</p>

<ul>
<li>The status and the spec stanzas are represented by the <code>.status</code> and <code>.spec</code> JSONPaths respectively inside of a custom resource.</li>
<li><code>PUT</code> requests to the <code>/status</code> subresource take a custom resource object and ignore changes to anything except the status stanza.</li>
<li><code>PUT</code> requests to the <code>/status</code> subresource only validate the status stanza of the custom resource.</li>
<li><code>PUT</code>/<code>POST</code>/<code>PATCH</code> requests to the custom resource ignore changes to the status stanza.</li>
<li>Any changes to the spec stanza increments the value at <code>.metadata.generation</code>.</li>
<li><code>properties</code>, <code>required</code> and <code>description</code> are the only constructs allowed in the root of the CRD OpenAPI validation schema.</li>
</ul>

<h4 id="scale-subresource">Scale subresource</h4>

<p>When the scale subresource is enabled, the <code>/scale</code> subresource for the custom resource is exposed.
The <code>autoscaling/v1.Scale</code> object is sent as the payload for <code>/scale</code>.</p>

<p>To enable the scale subresource, the following values are defined in the CustomResourceDefinition.</p>

<ul>
<li><p><code>SpecReplicasPath</code> defines the JSONPath inside of a custom resource that corresponds to <code>Scale.Spec.Replicas</code>.</p>

<ul>
<li>It is a required value.</li>
<li>Only JSONPaths under <code>.spec</code> and with the dot notation are allowed.</li>
<li>If there is no value under the <code>SpecReplicasPath</code> in the custom resource,
the <code>/scale</code> subresource will return an error on GET.</li>
</ul></li>

<li><p><code>StatusReplicasPath</code> defines the JSONPath inside of a custom resource that corresponds to <code>Scale.Status.Replicas</code>.</p>

<ul>
<li>It is a required value.</li>
<li>Only JSONPaths under <code>.status</code> and with the dotation are allowed.</li>
<li>If there is no value under the <code>StatusReplicasPath</code> in the custom resource,
the status replica value in the <code>/scale</code> subresource will default to 0.</li>
</ul></li>

<li><p><code>LabelSelectorPath</code> defines the JSONPath inside of a custom resource that corresponds to <code>Scale.Status.Selector</code>.</p>

<ul>
<li>It is an optional value.</li>
<li>It must be set to work with HPA.</li>
<li>Only JSONPaths under <code>.status</code> and with the dotation are allowed.</li>
<li>If there is no value under the <code>LabelSelectorPath</code> in the custom resource,
the status selector value in the <code>/scale</code> subresource will default to the empty string.</li>
</ul></li>
</ul>

<p>In the following example, both status and scale subresources are enabled.</p>

<p>Save the CustomResourceDefinition to <code>resourcedefinition.yaml</code>:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span>apiextensions.k8s.io/v1beta1<span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>CustomResourceDefinition<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>crontabs.stable.example.com<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>group:<span style="color:#bbb"> </span>stable.example.com<span style="color:#bbb">
</span><span style="color:#bbb">  </span>versions:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>v1<span style="color:#bbb">
</span><span style="color:#bbb">      </span>served:<span style="color:#bbb"> </span><span style="color:#a2f;font-weight:bold">true</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>storage:<span style="color:#bbb"> </span><span style="color:#a2f;font-weight:bold">true</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>scope:<span style="color:#bbb"> </span>Namespaced<span style="color:#bbb">
</span><span style="color:#bbb">  </span>names:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>plural:<span style="color:#bbb"> </span>crontabs<span style="color:#bbb">
</span><span style="color:#bbb">    </span>singular:<span style="color:#bbb"> </span>crontab<span style="color:#bbb">
</span><span style="color:#bbb">    </span>kind:<span style="color:#bbb"> </span>CronTab<span style="color:#bbb">
</span><span style="color:#bbb">    </span>shortNames:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>ct<span style="color:#bbb">
</span><span style="color:#bbb">  </span><span style="color:#080;font-style:italic"># subresources describes the subresources for custom resources.</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>subresources:<span style="color:#bbb">
</span><span style="color:#bbb">    </span><span style="color:#080;font-style:italic"># status enables the status subresource.</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>status:<span style="color:#bbb"> </span>{}<span style="color:#bbb">
</span><span style="color:#bbb">    </span><span style="color:#080;font-style:italic"># scale enables the scale subresource.</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>scale:<span style="color:#bbb">
</span><span style="color:#bbb">      </span><span style="color:#080;font-style:italic"># specReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Spec.Replicas.</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>specReplicasPath:<span style="color:#bbb"> </span>.spec.replicas<span style="color:#bbb">
</span><span style="color:#bbb">      </span><span style="color:#080;font-style:italic"># statusReplicasPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Replicas.</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>statusReplicasPath:<span style="color:#bbb"> </span>.status.replicas<span style="color:#bbb">
</span><span style="color:#bbb">      </span><span style="color:#080;font-style:italic"># labelSelectorPath defines the JSONPath inside of a custom resource that corresponds to Scale.Status.Selector.</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>labelSelectorPath:<span style="color:#bbb"> </span>.status.labelSelector</code></pre></div>
<p>And create it:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f resourcedefinition.yaml</code></pre></div>
<p>After the CustomResourceDefinition object has been created, you can create custom objects.</p>

<p>If you save the following YAML to <code>my-crontab.yaml</code>:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span><span style="color:#b44">&#34;stable.example.com/v1&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>CronTab<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>my-new-cron-object<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>cronSpec:<span style="color:#bbb"> </span><span style="color:#b44">&#34;* * * * */5&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>image:<span style="color:#bbb"> </span>my-awesome-cron-image<span style="color:#bbb">
</span><span style="color:#bbb">  </span>replicas:<span style="color:#bbb"> </span><span style="color:#666">3</span></code></pre></div>
<p>and create it:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f my-crontab.yaml</code></pre></div>
<p>Then new namespaced RESTful API endpoints are created at:</p>

<pre><code>/apis/stable.example.com/v1/namespaces/*/crontabs/status
</code></pre>

<p>and</p>

<pre><code>/apis/stable.example.com/v1/namespaces/*/crontabs/scale
</code></pre>

<p>A custom resource can be scaled using the <code>kubectl scale</code> command.
For example, the following command sets <code>.spec.replicas</code> of the
custom resource created above to 5:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl scale --replicas<span style="color:#666">=</span><span style="color:#666">5</span> crontabs/my-new-cron-object
crontabs <span style="color:#b44">&#34;my-new-cron-object&#34;</span> scaled

kubectl get crontabs my-new-cron-object -o <span style="color:#b8860b">jsonpath</span><span style="color:#666">=</span><span style="color:#b44">&#39;{.spec.replicas}&#39;</span>
<span style="color:#666">5</span></code></pre></div>
<h3 id="categories">Categories</h3>

<p>Categories is a list of grouped resources the custom resource belongs to (eg. <code>all</code>).
You can use <code>kubectl get &lt;category-name&gt;</code> to list the resources belonging to the category.
This feature is <strong>beta</strong> and available for custom resources from v1.10.</p>

<p>The following example adds <code>all</code> in the list of categories in the CustomResourceDefinition
and illustrates how to output the custom resource using <code>kubectl get all</code>.</p>

<p>Save the following CustomResourceDefinition to <code>resourcedefinition.yaml</code>:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span>apiextensions.k8s.io/v1beta1<span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>CustomResourceDefinition<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>crontabs.stable.example.com<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>group:<span style="color:#bbb"> </span>stable.example.com<span style="color:#bbb">
</span><span style="color:#bbb">  </span>versions:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>v1<span style="color:#bbb">
</span><span style="color:#bbb">      </span>served:<span style="color:#bbb"> </span><span style="color:#a2f;font-weight:bold">true</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>storage:<span style="color:#bbb"> </span><span style="color:#a2f;font-weight:bold">true</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>scope:<span style="color:#bbb"> </span>Namespaced<span style="color:#bbb">
</span><span style="color:#bbb">  </span>names:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>plural:<span style="color:#bbb"> </span>crontabs<span style="color:#bbb">
</span><span style="color:#bbb">    </span>singular:<span style="color:#bbb"> </span>crontab<span style="color:#bbb">
</span><span style="color:#bbb">    </span>kind:<span style="color:#bbb"> </span>CronTab<span style="color:#bbb">
</span><span style="color:#bbb">    </span>shortNames:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>ct<span style="color:#bbb">
</span><span style="color:#bbb">    </span><span style="color:#080;font-style:italic"># categories is a list of grouped resources the custom resource belongs to.</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>categories:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>all</code></pre></div>
<p>And create it:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f resourcedefinition.yaml</code></pre></div>
<p>After the CustomResourceDefinition object has been created, you can create custom objects.</p>

<p>Save the following YAML to <code>my-crontab.yaml</code>:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span><span style="color:#b44">&#34;stable.example.com/v1&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>CronTab<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>my-new-cron-object<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>cronSpec:<span style="color:#bbb"> </span><span style="color:#b44">&#34;* * * * */5&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>image:<span style="color:#bbb"> </span>my-awesome-cron-image</code></pre></div>
<p>and create it:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f my-crontab.yaml</code></pre></div>
<p>You can specify the category using <code>kubectl get</code>:</p>

<pre><code>kubectl get all
</code></pre>

<p>and it will include the custom resources of kind <code>CronTab</code>:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-console" data-lang="console">NAME                          AGE
crontabs/my-new-cron-object   3s</code></pre></div>















<h2 id="what-s-next">What&#39;s next</h2>
<ul>
<li>Learn how to <a href="../../migrate-third-party-resource/index.html">Migrate a ThirdPartyResource to CustomResourceDefinition</a>.</li>
<li>See <a href="../../../../reference/generated/kubernetes-api/v1.11/index.html#customresourcedefinition-v1beta1-apiextensions-k8s-io">CustomResourceDefinition</a>.</li>
<li>Serve <a href="https://v1-11.docs.kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/custom-resource-definitions-versioning" target="_blank">multiple versions</a> of a
CustomResourceDefinition</li>
</ul>






				<div class="issue-button-container">
					<p><a href="../../extend-api-custom-resource-definitions/index.html"><img src="https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions.md?pixel" alt="Analytics" /></a></p>
					
					
					<script type="text/javascript">
					PDRTJS_settings_8345992 = {
					"id" : "8345992",
					"unique_id" : "\/docs\/tasks\/access-kubernetes-api\/custom-resources\/custom-resource-definitions\/",
					"title" : "Extend the Kubernetes API with CustomResourceDefinitions",
					"permalink" : "https:\/\/kubernetes.io\/docs\/tasks\/access-kubernetes-api\/custom-resources\/custom-resource-definitions\/"
					};
					(function(d,c,j){if(!document.getElementById(j)){var pd=d.createElement(c),s;pd.id=j;pd.src=('https:'==document.location.protocol)?'https://polldaddy.com/js/rating/rating.js':'http://i0.poll.fm/js/rating/rating.js';s=document.getElementsByTagName(c)[0];s.parentNode.insertBefore(pd,s);}}(document,'script','pd-rating-js'));
					</script>
					<a href="../../extend-api-custom-resource-definitions/index.html" onclick="window.open('https://github.com/kubernetes/website/issues/new?title=Issue%20with%20' +
					'k8s.io'+window.location.pathname)" class="button issue">Create an Issue</a>
					
					
					
					<a href="../../../../editdocs#docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions.md" class="button issue">Edit this Page</a>
					
				</div>
			</div>
		</section>
		<footer>
    <main class="light-text">
        <nav>
            
            
            
            <a href="../../../../home.1">Documentation</a>
            
            <a href="../../../../../blog/index.html">Blog</a>
            
            <a href="../../../../../partners/index.html">Partners</a>
            
            <a href="../../../../../community/index.html">Community</a>
            
            <a href="../../../../../case-studies/index.html">Case Studies</a>
            
        </nav>
        <div class="social">
            <div>
                <a href="https://twitter.com/kubernetesio" class="twitter"><span>twitter</span></a>
                <a href="https://github.com/kubernetes/kubernetes" class="github"><span>Github</span></a>
                <a href="http://slack.k8s.io/" class="slack"><span>Slack</span></a>
            </div>
            <div>
                <a href="http://stackoverflow.com/questions/tagged/kubernetes" class="stack-overflow"><span>Stack Overflow</span></a>
                <a href="https://discuss.kubernetes.io" class="mailing-list"><span>Forum</span></a>
                <a href="https://calendar.google.com/calendar/embed?src=nt2tcnbtbied3l6gi2h29slvc0%40group.calendar.google.com" class="calendar"><span>Events Calendar</span></a>
            </div>
            <div>
                <a href="../../../../getting-started-guides/index.html" class="button">Get Kubernetes</a>
                <a href="https://git.k8s.io/community/contributors/guide" class="button">Contribute</a>
            </div>
        </div>
        <div id="miceType" class="center">
            &copy; 2018 The Kubernetes Authors | Documentation Distributed under <a href="https://git.k8s.io/website/LICENSE" class="light-text">CC BY 4.0</a>
        </div>
        <div id="miceType" class="center">
            Copyright &copy; 2018 The Linux Foundation&reg;. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our <a href="https://www.linuxfoundation.org/trademark-usage" class="light-text">Trademark Usage page</a>
        </div>
    </main>
</footer>

		<button class="flyout-button" onclick="kub.toggleToc()"></button>

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-36037335-10', 'auto');
ga('send', 'pageview');


(function () {
    window.addEventListener('DOMContentLoaded', init)

        
        function init() {
            window.removeEventListener('DOMContentLoaded', init)
                hideNav()
        }

    function hideNav(toc){
        if (!toc) toc = document.querySelector('#docsToc')
        if (!toc) return
            var container = toc.querySelector('.container')

                
                if (container) {
                    if (container.childElementCount === 0 || toc.querySelectorAll('a.item').length === 1) {
                        toc.style.display = 'none'
                            document.getElementById('docsContent').style.width = '100%'
                    }
                } else {
                    requestAnimationFrame(function () {
                        hideNav(toc)
                    })
                }
    }
})();
</script>



	</body>
</html>